package updatepotongan;


import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;


/**
 *
 * @author Ellis
 */
public class updatepotongantabelmodel extends AbstractTableModel {

    private ArrayList<potongan> k = new ArrayList<potongan>();

    public updatepotongantabelmodel(List<potongan> k) {
        this.k = (ArrayList<potongan>) k;
    }

    @Override
    public int getRowCount() {
        return k.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        potongan kategori = k.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return kategori.getNIP().getNIP();
            case 1:
                return kategori.getPinjaman();
            default:
                return " ";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "NIP ";
            case 1:
                return "Pinjaman ";
            default:
                return " ";
        }
    }
}
